Skip to content

Conversation

massimosala
Copy link
Owner

Hi

Please see
micropython#11735

The official page
https://docs.micropython.org/en/latest/genrst/builtin_types.html#float
should be updated about the different result of

float('_')

(and eventually other inconsistencies) between Python and MicroPython.

agatti and others added 29 commits August 26, 2025 12:27
This commit introduces a new target for the QEMU port called
"MPS2_AN500", an ARMv7-M machine with a Cortex-M7 CPU and
single-/double-precision floating point unit.

Signed-off-by: Alessandro Gatti <[email protected]>
This commit extends the QEMU port's CPU error handler for the Arm target
by printing out in detail the ARMv7-M debug registers if the firmware is
compiled for such a target.

Signed-off-by: Alessandro Gatti <[email protected]>
This commit lets CI extend the testing scope of the QEMU Arm target, by
letting it perform the usual battery of tests (interpreter and natmods)
also on hardfp targets.

The default board for Arm testing lacks hardware floating point support,
so natmods weren't tested in that specific configuration.  With the
introduction of the "MPS_AN500" QEMU target, now this is made possible
as said board emulates a Cortex-M7 machine with a single- and
double-precision floating point unit.

To reduce the impact on build times, the "ci_qemu_build_arm_thumb" CI
step was split in two: "ci_qemu_build_arm_thumb_softfp" and
"ci_qemu_build_arm_thumb_hardfp" - so hopefully those can run in
parallel whenever possible.

Signed-off-by: Alessandro Gatti <[email protected]>
This commit fixes a linking issue on certain Arm toolchains where
library code is compiled with exception support.

If a library with exception support is included in the MicroPython
build, the linker had no place to put the stack unwinding tables
necessary to perform exception handling at runtime.  This change adds a
new section to the linkerscript (and therefore the final ELF file) where
that data can be placed into.

Signed-off-by: Alessandro Gatti <[email protected]>
This commits lifts the unconditional restriction on inline assembler FPU
tests for the Qemu platform, and makes said restriction conditional to
the lack of an available floating point unit on the running platform.

The Qemu platform supported only emulated machines that could target up
to a Cortex-M3, so an ArmV7-M target that had no support for floating
point.  With the addition of MPS2_AN500 to the list of emulated targets
the range was extended to cover up to Cortex-M7, so a floating point
unit may possibly be available and thus able to run the FPU inlineasm
tests.

For that, the test runner was changed to detect the running architecture
when checking the target capabilities; if the target reports its
MicroPython architecture to be either "armv7emsp" or "armv7emdp"
(providing single-precision and double-precision floating point unit
support respectively) then the FPU-only inline tests are not put into
the blocked tests list.

Signed-off-by: Alessandro Gatti <[email protected]>
This was missed as part of the transition to make_new a mp_obj_type_t slot.

See also: 94beeab

Signed-off-by: David Schneider <[email protected]>
This commit lets "tools/mpy-tool.py" extract MPY segments into their own
files, one file per segment.

A pair of new command line arguments were added, namely "-e"/"--extract"
that takes a filename prefix to use as a base for the generated files'
name, and "--extract-only" that - combined with "--extract" - allows
selecting which kinds of segment should be dumped to the filesystem.

So, for example, assuming there's a file called "module.mpy", running
"./mpy-tool.py --extract segments module.mpy" would yield a series of
files with names like "segments_0_module.py_QSTR_module.py.bin",
"segments_1_module.py_META__module_.bin",
"segments_2_module.py_QSTR_function.bin", etc.  In short the file name
format is "<base>_<count>_<sourcefile>_<segmentkind>_<segmentname>.bin",
with <segmentkind> being META, QSTR, OBJ, or CODE.  Source file names
and segment names will only contain characters in the range
"a-zA-Z0-9_-." to avoid having output file names with unexpected
characters.

The "--extract-only" option can accept one or more kinds, separated by
commas and treated as case insensitive strings.  The supported kinds
match what is currently handled by the "MPYSegment" class in
"tools/mpy-tool.py": "META", "QSTR", "OBJ", and "CODE".  The absence of
this command line option implies dumping every segment found.

If "--extract" is passed along with "--merge", dumping is performed
after the merge process takes place, in order to dump all possible
segments that match the requested segment kinds.

Signed-off-by: Alessandro Gatti <[email protected]>
The `thread/thread_gc1.py` test is a constant source of spurious failures
in Github CI.

This commit adds it to the list of tests skipped when running on Github CI
using either macos, qemu_riscv64, qemu_mips, or qemu_arm, to help reduce
the overall false positive rate and improve the predictive value of the
test fail indication.

Signed-off-by: Anson Mansfield <[email protected]>
These functions were removed in 6c9fca2 for v1.9.3.  This commit removes
their declarations as well.

See-also: 6c9fca2
Signed-off-by: Anson Mansfield <[email protected]>
Re-organize `mp_parse_num_integer()` (for longlong) slightly so that the
most negative 64-bit integer can be parsed.

Fixes issue #17932.

Signed-off-by: Jeff Epler <[email protected]>
These files are only built on demand for developers, and it is a quick
process.

Without FORCE, a sequence like this would leave the developer with an
outdated `main.pp` to inspect:

    make build-standard/main.pp
    touch input.h
    make build-standard/main.pp # Rebuilds now, wouldn't have before

Signed-off-by: Jeff Epler <[email protected]>
So it can be reused by other test runners.

Signed-off-by: Damien George <[email protected]>
Back in commit 8978102 (see PR #16111) the
`run-tests.py` script was changed to use an improved way of selecting the
test instance, eg:

    $ ./run-tests.py -t a0

that would run on /dev/ttyACM0.  This has been a very nice improvement,
makes it easier to specify the target.

This commit updates `run-multitests.py` to use the same scheme.  It
previously used `-i` but now that's changed to `-t`.

Signed-off-by: Damien George <[email protected]>
Following the similar change to `run-tests.py` and `run-multitests.py`.
What was previously, eg, `-p -d /dev/ttyACM0` is now `-t a0`.

Signed-off-by: Damien George <[email protected]>
And the existing "-t" option is changed to "-m" (shorthand for the
"--diff-time" option).

Signed-off-by: Damien George <[email protected]>
The unix port doesn't have `micropython.alloc_emergency_exception_buf()`
but it's still possible to run and pass this test.  So make that call
optional.

Signed-off-by: Damien George <[email protected]>
These were missed in 2bba507 because they
didn't use the `os.stat` pattern.

Signed-off-by: Damien George <[email protected]>
Reduces ESP32_GENERIC_C6 application flash size from 2024432 to
1813216 (206KB smaller).

Also has benefit of reducing D/IRAM size, increasing free memory at
runtime (167187 to 148584, -18603 bytes).

Most of this savings comes from building with -Os instead of -O2,
but about 10KB comes from using the SPI flash functions from the ROM.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <[email protected]>
Same optimisation that was applied to C6 in the parent commit, now applied
to all RISC-V boards.

    +------------+------------+------------+------------+
    | Size       | Before     | After      | Delta      |
    +------------+------------+------------+------------+
    | C2 Binary  | 1680384    | 1494224    | -186160    |
    | C2 D/IRAM  |   83710    |   79080    |   -4630    |
    | C3 Binary  | 1833328    | 1636624    | -196704    |
    | C3 D/IRAM  |  139608    |  131896    |   -7712    |
    +------------+------------+------------+------------+

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <[email protected]>
I2S works on the ESP32-C6, and it now has enough space to fit.

Signed-off-by: Jimisola Laursen <[email protected]>
Signed-off-by: Damien George <[email protected]>
This reverts commit 3c9546e.

I2CTarget now fits on ESP32-C6 because it's compiled with -Os, see commit
5b98126.

Signed-off-by: Damien George <[email protected]>
This is intended to be equivalent to the unlock in
shared/runtime/pyexec.c.

Signed-off-by: Jeff Epler <[email protected]>
Saves code size for the same functionality.

Signed-off-by: Jeff Epler <[email protected]>
STM32L4 uses the same I2C controller as STM32WB.  Change `defined(STM32WB)`
to `defined(STM32L4) || defined(STM32WB) ` in relevant files.

Also remove the dummy definition of I2C2_BASE for STM32L432xx.  It's now
provided by the dummy definition in `i2cslave.h`.

Signed-off-by: Chris Mason <[email protected]>
Signed-off-by: Damien George <[email protected]>
As required by the datasheet.

Signed-off-by: iabdalkader <[email protected]>
This makes the rp2-specific lightsleep test more lenient, so it passes.

This test was added in PR #16454 / 69993da
and even back then it did not pass reliably on RP2040.  The issue is that
threads can race each other to enter lightsleep mode, and when one of them
actually stops the CPU clock the other thread is stopped as well.
Depending on whether the other thread was just entering or just exiting
lightsleep itself, the total duration of all sleeps can vary and can be as
small as 2*T.

Therefore, adjust the minimum to allow 2*T.

`machine.lightsleep()` is anyway 1) specified only to wait at most the
given time; and 2) not well specified when multiple threads call it at the
same time.  So it seems OK to make the test more lenient.

Work done in collaboration with @projectgus.

Signed-off-by: Damien George <[email protected]>
jepler and others added 30 commits October 8, 2025 15:08
Changes of interest could be in emitted mpy frozen files.

Signed-off-by: Jeff Epler <[email protected]>
For instance, to compare HEAD to origin/master on only the minimal x86
build, use

    PORTS_TO_CHECK=m REFERENCE=origin/master tools/ci.sh code_size_build

Signed-off-by: Jeff Epler <[email protected]>
This is a necessary step to allow cleanly building the xtensa port during
CI, as it's undesirable to apply the esp-idf environment settings while
building other ports.

PRE_CMD_<letter> can be used to override the command, or add a command if
not otherwise specified.  Note that <letter> is case sensitive.

Signed-off-by: Jeff Epler <[email protected]>
It was removed (possibly inadvertently)
in 4c55b08

Signed-off-by: Jeff Epler <[email protected]>
Regression from 449866c.

Signed-off-by: Angus Gratton <[email protected]>
Remove CONFIG_NEWLIB_LIBC=y, as it seems it is now unecessary.

Signed-off-by: Vdragon <[email protected]>
Adds overlay and conf for RPi Pico2 ARM cpu on the zephyr port.

Signed-off-by: Vdragon <[email protected]>
This commit adds support for ADC peripherals in the Zephyr port.

As is typical for Zephyr, the ADC channel setup is done in the devicetree
(typically using an overlay).  This code requires ADC channels to be listed
in the io-channels property of the zephyr,user root node.

Signed-off-by: Ned Konz <[email protected]>
This commit adds `Sensor.attr_set()` and `Sensor.attr_get_*()` methods that
are necessary to set various sensor attributes if they haven't been set
statically in the device tree.

This is needed, for example, because the LSM6DS3TR-C sensor on the XIAO BLE
NRF52840 SENSE board will not work with `zsensor` because it doesn't have
any default configuration for sampling frequency.

Various `SENSOR_ATTR_*` constants from
`zephyr/incude/zephyr/drivers/sensor.h` have been added as `ATTR_*`
constants in the `zsensor` module.

Signed-off-by: Ned Konz <[email protected]>
Add support for PocketBeagle 2 rev A0 m4.  Since it has 256K of SRAM (split
into 192K instruction and 64K data regions), some things need to be
disabled in MicroPython to make it fit.

Signed-off-by: Ayush Singh <[email protected]>
Same configuration as rev A0.

Signed-off-by: Ayush Singh <[email protected]>
Much cleaner. Also add deltas to the output table for easier
interpretation.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <[email protected]>
Factors out the space-saving config options from `sdkconfig.d2wd` to a new
`sdkconfig.flash_2MiB` file, and uses that in the new C2 FLASH_2M variant.

Signed-off-by: Florent <[email protected]>
Tested with ESP32_GENERIC, ESP32_GENERIC_C3, ESP32_GENERIC_C6 and
ESP32_GENERIC_S3 firmware, using the full test suite.  There do not seem to
be any regressions.

Signed-off-by: Damien George <[email protected]>
Saves approx 19KB on ESP32-C6 and 11KB on ESP32-C2, meaning IDF V5.5.1
builds now have more free RAM than V5.4.2.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.